﻿using System;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;

namespace Grundy.Message
{
    
    [DataContract]
    public class CustomerEntitlement
    {
        public bool Equals(CustomerEntitlement other)
        {
            if (ReferenceEquals(null, other)) return false;
            if (ReferenceEquals(this, other)) return true;
            return other.Id.Equals(Id);
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != typeof (CustomerEntitlement)) return false;
            return Equals((CustomerEntitlement) obj);
        }

        public override int GetHashCode()
        {
            return Id.GetHashCode();
        }

        public static bool operator ==(CustomerEntitlement left, CustomerEntitlement right)
        {
            return Equals(left, right);
        }

        public static bool operator !=(CustomerEntitlement left, CustomerEntitlement right)
        {
            return !Equals(left, right);
        }

        [DataMember]
        public Guid Id { get; set; }
        [Required]
        [DataMember]
        public Customer Customer { get; set; }
        [DataMember]
        public virtual LicenseEntitlementCollection LicenseEntitlements { get; set; }
    }
}
